#include<iostream>
#include<string>
#include<list>
#include<vector>

using std::cout;
using std::endl;
using std::string;
using std::list;
using std::vector;

void print(const vector<string> & lhs)
{
    for(auto&i:lhs)
    {
        cout<<i<<" ";
    }
    cout<<endl;
}
int main(void)
{
    list<const char*> lst={"hello","world","!"};
    vector<string> str;

    //循环赋值
    for(auto& i:lst)
    {
        str.push_back(i);
    }
    print(str);
    //迭代器
    vector<string> str2(lst.begin(),lst.end());
    print(str2);

    vector<string> str3;
    //reserve开辟空间，但是元素并没有初始化.

    /* str3.reserve(5); */
    /* int num=0; */
    //拷贝构造循环赋值
    /* for(auto& i:lst) */
    /* { */
        /* str3[num++]=i;; */
        /* cout<<str3.size()<<" for size"<<endl; */
    /* } */
    /* cout<<str3.size()<<" size"<<endl; */
    /* print(str3); */
    /* num=0; */
    /* for(auto& i:lst) */
    /* { */
        /* cout<<i<<" "; */
    /* } */
}

